<?php

namespace app\model\office;

use app\model\BaseModel;
use think\model\concern\SoftDelete;

class OfficeMajor extends BaseModel
{
    use SoftDelete;

    /**
     * 数据表主键
     * @var string
     */
    protected $pk = 'id';

    /**
     * 模型名称
     * @var string
     */
    protected $table = 'free_office_major';
    protected $deleteTime = 'delete_time';
    protected $defaultSoftDelete = '0000-00-00 00:00:00';


    public function searchTitleAttr($query, $value)
    {
        $query->where('title', 'like', '%' . $value . '%');
    }

    public function searchLevelAttr($query, $value)
    {
        if ($value) $query->where('level', $value);
    }

    public function searchMajorCodeAttr($query, $value)
    {
        if ($value) $query->where('major_code', $value);
    }

}